Swissroll model

Sample a hidden state and an swissroll-transformed emission trajectory. Demonstrates deeptime.data.swissroll_model().

 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 import matplotlib.pyplot as plt
 from matplotlib import animation

 from deeptime.data import swissroll_model

 n_samples = 500
 dtraj, traj = swissroll_model(n_samples)

 fig = plt.figure()
 ax = fig.add_subplot(111, projection='3d')


 def init():
     ax.scatter(*traj.T, marker='o', s=20, c=dtraj, alpha=0.6)
     return fig,


 def animate(i):
     ax.view_init(elev=10., azim=3*i)
     return fig,


 # Animate
 anim = animation.FuncAnimation(fig, animate, init_func=init,
                                frames=120, interval=40, blit=False)

Total running time of the script: ( 0 minutes 21.077 seconds)

Estimated memory usage: 9 MB

Gallery generated by Sphinx-Gallery